#! /bin/bash
ip_list="192.168.1.101 192.168.1.102 192.168.1.103 192.168.1.106"
while read ip
do
	for count in `seq 3`
	do
		ping -c1 -W1 $ip &>/dev/null
		if [ $? -eq 0 ];then
			echo "$ip ping is ok..."
			break
		else
			echo "$ip ping is failure :$count"
			fail_count[$count]=$ip
		fi
	done
	if [ ${#fail_count[*]} -eq 3 ];then
		echo "${fail_count[1]} ping os failure!"
		unset fail_count[*]
	fi
done <ip.txt

